<?php
	include("../include/config.php");
	include("../include/functions.php");
	if(isset($_POST['home_id']) && $_POST['home_id']==''){
			$pr_id=array_shift($_POST);
			
			
			$_POST['created_date']=date("Y-m-d H:i:s");
			
			$_POST['updated_date']=date("Y-m-d H:i:s");
			
			
			$_POST['block1_description']=htmlspecialchars(str_replace("'","",$_POST['block1_description']));
			$_POST['block2_description']=htmlspecialchars(str_replace("'","",$_POST['block2_description']));
			$_POST['metadescription']=str_replace("'","",$_POST['metadescription']);
			
			db_insert(DB_PREFIX.'homepage',$_POST);
			
			header('location:../admin.php?data=homepage&msg=success');
			
	}else{
		$product_id=array_shift($_POST);
		
			
		
			$_POST['block1_description']=htmlspecialchars(str_replace("'","",$_POST['block1_description']));
			$_POST['block2_description']=htmlspecialchars(str_replace("'","",$_POST['block2_description']));
			$_POST['metadescription']=str_replace("'","",$_POST['metadescription']);
			db_update(DB_PREFIX.'homepage',$_POST,array('home_id'=>$product_id));
			
			header('location:../admin.php?data=homepage&msg=updated');
	}
?>